package com.des1gn.ymgetil.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ApiEnums {

    GET_USERINFO("获取用户信息","https://cloud.cn2030.com/sc/wx/HandlerSubscribe.ashx?act=User"),
    SET_USERINFO("设置用户信息","https://cloud.cn2030.com/sc/wx/HandlerSubscribe.ashx?act=Reg&birthday=BIRTHDAY&tel=PHONE&cname=USERNAME&sex=SEX&idcard=CARDNO&doctype=CARDTYPE&age=AGE"),
    GET_YMTYPE("获取疫苗类型","https://cloud.cn2030.com/sc/wx/HandlerSubscribe.ashx?act=GetCat1"),
    GET_SMALLTYPE("获取小类型","https://cloud.cn2030.com/sc/wx/HandlerSubscribe.ashx?act=GetCat2&id=CODE"),
    GET_HOSPITAL("获取医院列表","https://cloud.cn2030.com/sc/wx/HandlerSubscribe.ashx?act=CustomerList&city=%5B%22%22%2C%22%22%2C%22%22%5D&lat=30.57447&lng=103.92377&id=0&cityCode=0&product=SMALLCODE"),
    GET_PRODUCT("获取产品列表","https://cloud.cn2030.com/sc/wx/HandlerSubscribe.ashx?act=CustomerProduct&id=HOSPITALID&lat=30.57447&lng=103.92377"),
    GET_DATEDETAIL("获取预约日期","https://cloud.cn2030.com/sc/wx/HandlerSubscribe.ashx?act=GetCustSubscribeDateAll&pid=PRODUCTCODE&id=HOSPITALCODE&month=MONTH"),
    GET_TIMEDETAIL("获取预约时间","https://cloud.cn2030.com/sc/wx/HandlerSubscribe.ashx?act=GetCustSubscribeDateDetail&pid=PRODUCTCODE&id=HOSPITALCODE&scdate=DATE"),
    GET_CAPTCHA("验证是否可预约","https://cloud.cn2030.com/sc/wx/HandlerSubscribe.ashx?act=GetCaptcha&mxid=MXID"),
    SUBMIT("提交预约","https://cloud.cn2030.com/sc/wx/HandlerSubscribe.ashx?act=Save20&birthday=BIRTHDAY&tel=PHONE&sex=SEX&cname=USERNAME&doctype=CARDTYPE&idcard=CARDNO&mxid=MXID&date=DATE&pid=PRODUCTCODE&Ftime=1&guid="),
    GET_ORDERSTATUS("获取订单状态","https://cloud.cn2030.com/sc/wx/HandlerSubscribe.ashx?act=GetOrderStatus"),
    GET_ORDERLIST("查询订单列表","https://cloud.cn2030.com/sc/wx/HandlerSubscribe.ashx?act=UserSubcribeList"),
    GET_MIAOPRODUCTLIST("查询产品列表","https://miaomiao.scmttec.com/seckill/seckill/list.do?offset=0&limit=10&regionCode=5101"),
    GET_MIAOPRODUCTDETAIL("查询产品信息","https://miaomiao.scmttec.com/seckill/seckill/checkstock2.do?id=ID"),
    GET_SUBMITORDER("提交订单","https://miaomiao.scmttec.com/seckill/seckill/subscribe.do?seckillId=MSID&linkmanId=USERID&idCardNo=IDCARDNO"),
    GET_DATE("获取日期","https://miaomiao.scmttec.com/seckill/seckill/subscribeDays.do?id=MSID&sid=ORDERID"),
    GET_TIMES("获取时间段","https://miaomiao.scmttec.com/seckill/seckill/dayTimes.do?id=MSID&sid=ORDERID&day=DAY"),
    GET_TO("提交预约","https://miaomiao.scmttec.com/seckill/seckill/submitDateTime.do?id=MSID&sid=ORDERID&day=DAY&wid=WID");

    private String desc;

    private String apiUrl;


    public static String getApi(String desc){
        for (ApiEnums data : ApiEnums.values()){
            if (data.getDesc().equals(desc)){
                return data.getApiUrl();
            }
        }
        return null;
    }

}
